<?php $this->pageTitle = Yii::app()->user->name; ?>
<div class="c_body">
	<div class="cat_head">
		<div class="cat_head_strip"></div>
		<?php if($checkOwner):?> 
			<a href="<?php echo Yii::app()->createUrl('albums/createGroup', array('group'=>Yii::app()->request->getParam('group'))); ?>" class="green_btn r_m"><i>+</i>Создать альбом</a>
		<?php endif; ?>
		<div class="cat_head_h t">
			<p class="cat_head_h_txt"><span><?php echo $photos; ?></span> фотографии в <span><?php echo $albums; ?></span> альбомах</p>
			<a class="cat_head_h_edit" href="<?php echo Yii::app()->createUrl('albums/commentsGroup', array('group'=>Yii::app()->request->getParam('group'))); ?>">Комментарии к альбомам</a>
		</div>
	</div>
	<div class="cat_list_block">
		<div class="cat_list">
		<!-- Albums -->
			<?php foreach ($model as $key => $value) : ?>
				<div class="cat_list_item album_list_item">
					<?php if($checkOwner):?>
						<div class="u_media" >
							<?php if($value->main_photo!=NULL) echo $this->material_image($value->id, $value->main_photo->name, '180', 'groups/'.$value->group->id.'/'.$value->id); ?>
							<div class="mask hover hidden"></div>
							<div class="links hidden">
								<a href="<?php echo Yii::app()->createUrl('albums/uploadGroup', array('id'=>$value->id, 'group'=>Yii::app()->request->getParam('group'))); ?>" class="u_link"><span class="u_link_icon i4"></span><em>Добавить фотографию</em></a>
								<a href="<?php echo Yii::app()->createUrl('albums/updateGroup', array('id'=>$value->id, 'group'=>Yii::app()->request->getParam('group'))); ?>" class="u_link"><span class="u_link_icon i5"></span><em>Редактировать</em></a>
								<a href="<?php echo Yii::app()->createUrl('albums/deleteGroup', array('id'=>$value->id, 'group'=>Yii::app()->request->getParam('group'))); ?>" class="u_link removeLink"><span class="u_link_icon i6"></span><em>Удалить</em></a>
							</div>
						</div>
					<?php else:?>
						<a class="u_media" href="<?php echo Yii::app()->createUrl('albums/viewGroup', array('id'=>$value->id, 'group'=>Yii::app()->request->getParam('group'))); ?>">
							<?php if($value->main_photo!=NULL) echo $this->material_image($value->id, $value->main_photo->name, '180', 'groups/'.$value->group->id.'/'.$value->id); ?>
							<div class="mask hover hidden"></div>
						</a>
					<?php endif;?>
					<div class="u_media_nav">
						<a href="<?php echo Yii::app()->createUrl('albums/viewGroup', array('id'=>$value->id, 'group'=>Yii::app()->request->getParam('group'))); ?>" class="u_media_nav_name"><?php echo $value->name ?></a>
						<p class="media_time"><i><?php echo $value->countPhotos ?></i> фотографий</p>
					</div>
				</div>
			<?php endforeach; ?>
		<!-- END Albums -->
		</div>
		<div class="u_cat_head"><a href="#"><i>Последние </i>Загруженные фото</a></div>
		<div class="cat_list">
			<?php foreach ($lastphotos as $key => $value) : ?>
				<a href="<?php echo Yii::app()->createUrl('albums/photoGroup', array('id'=>$value->id, 'group'=>Yii::app()->request->getParam('group')));?>" class="cat_list_item photoBg">
					<?php echo $this->material_image($value->id, $value->name, '200', 'groups/'.$value->album->group->id.'/'.$value->album->id); ?>
				</a>
			<?php endforeach; ?>
		</div>
	</div>
	<div class="clear"></div>
</div>